import 'package:firebase_message_plugin_example/firebase_message_tools.dart';
import 'package:firebase_message_plugin_example/user_manager.dart';
import 'package:flutter/material.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  UserManager().initBusinessConfig();
  await UserManager().initServices();
  // 设置后台消息处理器
  await FirebaseMessageTools.instance.initFirebaseMessaging();
  
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Firebase Message Plugin Example'), backgroundColor: Colors.blue),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Card(
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [Text('Permission Status', style: Theme.of(context).textTheme.titleLarge)],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
